home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / internet-tools / connect-line / cl / rexx / cl-fixboardpaths.clrexx < prev    next >
Encoding:
Text File  |  1996-02-05  |  4.2 KB  |  145 lines

  1. /*
  2. **  $VER: CL-FixBoardPaths.clrexx 0.3 (05 Feb 1996)
  3. **
  4. **        © 1995-96 Ralf Ramge
  5. **
  6. **  PROGRAMNAME:
  7. **      CL-FixBoardPaths.clrexx
  8. **
  9. **  FUNCTION:
  10. **      Demonstrationsskript zur cl_rexx.library, Connectline 5.0
  11. **
  12. **      Connectline © 1986-1995 Oliver Wagner, Mathias Mischler
  13. **      cl_rexx.library © 1995 Mathias Mischler
  14. **
  15. **      Dieses Skript setzt sämtliche Brettpfade auf den in der Haupt-
  16. **      konfiguration angegebenen Standardpfad, sofern sie von diesem
  17. **      abweichen. Die Brettinhalte werden soweit vorhanden umkopiert.
  18. **
  19. **      Für den Kopiervorgang wird ein 'rename' benutzt, dennoch be-
  20. **      steht die Gefahr, daß bei über mehrere Partitionen verteilten
  21. **      Bretter die Brettpfade von vorne bis hinten nicht mehr stimmen.
  22. **      Fertigen sie vor einem etwaigen Aufruf daher eine Sicherheits-
  23. **      kopie ihrer Bretterpartition(en)  und ihrer Brettliste an!
  24. **
  25. **      DISCLAIMER:
  26. **      Dieses Skript ist vorrangig für Demonstrationszwecke gedacht.
  27. **      Ein Einsatz dieses Skripts im praktischen Mailboxbetrieb kann
  28. **      mitunter zu Verlusten lokal eingelagerter Nachrichten führen,
  29. **      denn die Brettpfade werden elementar verändert.
  30. **      Jeglicher Einsatz dieses Skripts erfolgt auf eigene Verantwor-
  31. **      tung des Benutzers, für enstandene Schäden können die Copyright-
  32. **      inhaber nicht haftbar gemacht werden.
  33. **
  34. */
  35.  
  36.  
  37. /* rexxsupport.library öffnen */
  38.  
  39. if ~show('L','rexxsupport.library') then do
  40.     if ~addlib('rexxsupport.library',0,-30,0) then exit 10
  41.     end
  42.  
  43. /* cl_rexx.library öffnen */
  44.  
  45. if ~show('L','cl_rexx.library') then do
  46.     if ~addlib('cl_rexx.library',0,-30,0) then exit 10
  47.     end
  48.  
  49. /* Fontsize ermitteln */
  50.  
  51. gfxbase=showlist(l,'graphics.library',0,a)
  52. call forbid
  53. FontAddress=next(gfxbase,154)
  54. Fontsize=c2d(IMPORT(offset(FontAddress,20),2))
  55. call permit
  56. windowwidth=Fontsize*80
  57. windowheight=Fontsize*15
  58. windowY=Fontsize+1
  59. WindowX=Fontsize
  60.  
  61.  
  62.  
  63. /* Standard-IO umleiten */
  64.  
  65. screen=CLGET_FrontScreenName()
  66.  
  67. call close STDOUT
  68. if ~open(STDOUT,'CON:'windowX'/'windowY'/'windowwidth'/'windowheight'/CL-FixBoardPath/SCREEN'screen,'W') then
  69.     exit 20
  70. else do
  71.     call close STDIN
  72.     call open STDIN,'*',R
  73.     call pragma '*'
  74.     end
  75.  
  76. say 'Sie haben CL-FixBoardPaths.clrexx gestartet.'
  77. options prompt "Wollen Sie die Brettpfade wirklich korrigieren lassen?"
  78. pull wahl
  79. if wahl~='J' then exit
  80.  
  81.  
  82.  
  83. /* Hauptprogamm */
  84.  
  85.    stdpfad=CLGET_PathBoard()
  86.  
  87.    say 'Ermittelter Standardpfad: 'stdpfad
  88.    say ''
  89.  
  90. /* So, und jetzt geht die Malocherei in der Brettliste los */
  91.  
  92.    anzahl=CLGET_BoardNumberOf()                 /* Anzahl der Bretter */
  93.    prev=''
  94.  
  95.    do x=1 to anzahl
  96.     brett=CLGET_BoardNext(prev)
  97.     prev=brett
  98.     brettpfad=CLGET_BoardPath(brett)
  99.     if brettpfad~=stdpfad||brett then do       /* Nicht auf Standardpfad */
  100.  
  101.         /* Jetzt müssen erstmal die Verzeichnisse alle angelegt werden */
  102.  
  103.         do nextdir=1 to words(brett)
  104.             temppfad=stdpfad||word(brett,nextdir)
  105.             call makedir temppfad
  106.             end
  107.  
  108.         /* Und nun kopieren wir alle Brettinhalte auf den neuen Pfad */
  109.         /* Und zwar alle Files in diesem Brett, keine Dirs           */
  110.  
  111.         Inhalt=''
  112.  
  113.         /* Wenn man showdir() als Parameter einen Leerstring über-  */
  114.         /* gibt, liefert die Funktion das aktuelle Verzeichnis zu-  */
  115.         /* rück. Diese Angabe müssen wir ausfiltern.                */
  116.  
  117.         if brettpfad~='' then do
  118.             Inhalt=showdir(brettpfad,'FILE')
  119.             files=words(Inhalt)
  120.             if right(brettpfad,1)~='/' then brettpfad=brettpfad'/'
  121.             say 'Kopiere 'brettpfad'#? -> 'temppfad' ('files' Files)'
  122.  
  123.             if files>0 then do
  124.                 do y=1 to files
  125.                     name=word(Inhalt,y)
  126.                     if (rename(brettpfad||name,temppfad||'/'name) then do
  127.                     call CLSET_BoardPath(temppfad)
  128.                     end
  129.                 end
  130.         else do
  131.             say 'Keine Pfadangabe, lege 'temppfad' neu an!'
  132.             call CLSET_BoardPath(brett,temppfad)
  133.             call CLSET_BoardRouteOnly(brett,1)
  134.             call CL_LogAdd(0,'FIXBPATH','Pfad von /'brett' jetzt:'temppfad)
  135.             end
  136.         end
  137.     end
  138.  
  139. options prompt "<Bitte drücken Sie RETURN>"
  140. pull dummy
  141.  
  142. call close STDOUT
  143. call close STDIN
  144. return
  145.